replication version preflight - #106
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #106 +/- ##
==========================================
+ Coverage 94.61% 94.73% +0.11%
==========================================
Files 27 27
Lines 20417 20623 +206
==========================================
+ Hits 19318 19537 +219
+ Misses 1099 1086 -13 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request introduces client-side server-version preflight checks for replication SQL commands (such as creating, altering, and reading replication slots, as well as base backups) to prevent opaque server-side syntax errors on unsupported PostgreSQL versions. It also refactors the relation_metadata helper in the protocol module to return a structured RelationMetadata struct instead of a complex tuple, and adds a comprehensive integration test suite (version_preflight.rs) along with corresponding unit tests. I have no feedback to provide as there are no review comments.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces client-side server-version preflight checks for PostgreSQL replication commands (such as creating, altering, reading replication slots, and base backups) to catch unsupported options early with clear client-side errors. It also refactors relation_metadata to return a structured RelationMetadata instead of a tuple, and adds corresponding integration and unit tests. A critical issue was identified in the new integration tests where drop_slot attempts to execute a SELECT query on a replication connection, which will fail with a protocol error; using the native drop_replication_slot method is recommended instead.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
d64fb17 to
76e49b4
Compare
|
/gemini review |
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Important Review skippedNo new commits to review since the last review. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughChangesThe change adds PostgreSQL version preflight checks before replication SQL execution, wires them into both connection implementations, adds integration coverage for CDC and PG17+ slot operations, and restructures relation metadata decoding around a dedicated struct. Replication preflight and validation
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant ReplicationConnection
participant sql_builder
participant PostgreSQL
Client->>ReplicationConnection: invoke replication operation
ReplicationConnection->>sql_builder: check server version and options
sql_builder-->>ReplicationConnection: validation result
ReplicationConnection->>PostgreSQL: execute supported replication SQL
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/gemini review |
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Pull request overview
This PR adds client-side PostgreSQL server-version “preflight” checks for replication-related SQL (slot create/alter/read and base backup) so unsupported options fail early with clear configuration errors, and refactors relation metadata handling to use a structured type to improve decode-path clarity.
Changes:
- Introduces version-gated preflight helpers in
sql_builderand wires them into both libpq and native connection backends before issuing SQL. - Refactors
relation_metadatato return aRelationMetadatastruct and updates decoding + tests accordingly. - Adds a new integration test (
version_preflight) and runs it in CI; bumps a couple of Rust dependencies.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/stream.rs | Updates tests to use the new structured relation metadata return type. |
| src/sql_builder.rs | Adds server-version preflight checks for replication slot and base backup SQL. |
| src/protocol.rs | Introduces RelationMetadata struct and updates message decoding + tests. |
| src/connection/native/connection.rs | Calls preflight checks before issuing version-gated SQL commands. |
| src/connection/libpq.rs | Calls preflight checks before issuing version-gated SQL commands. |
| integration-tests/version_preflight.rs | Adds live-server integration coverage for preflight + a CDC smoke test. |
| Cargo.toml | Adds the new integration test target and bumps dev/runtime deps. |
| Cargo.lock | Updates lockfile for dependency bumps. |
| .github/workflows/ci-checks.yml | Runs the new integration test in CI and adds slot cleanup before it. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot review |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 9 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/sql_builder.rs:481
- There is a double space in this comment (“with its”), which looks like a typo and can hurt readability/searchability.
// The builders above are pure and hold no server-version state by design. The preflight below is the separate, equally-pure gate a *connection* applies (with its known `server_version()`) before issuing a version-gated command, so an unsupported option fails with an actionable client-side error instead of an opaque server-side `syntax error`. Only the `libpq` / `rustls-tls` backends call these, so the whole group lives in a feature-gated module: the parser-only / no_std (`--no-default-features`) build compiles it out entirely — no callers, no `dead_code`, no per-item `allow`.
Reviewed the PR changes. Two issues addressed in commit 7b2a22e:
|
…oved clarity and maintainability Update dependencies: bump tokio to 1.53.1 and serde_json to 1.0.151 Add server-version preflight checks for replication slot operations and base backup options Add preflight checks for replication slot and base backup options based on PostgreSQL version
7b2a22e to
f924c43
Compare
Refactor relation metadata handling to use a structured type for improved clarity and maintainability
Summary by CodeRabbit
New Features
Bug Fixes